package com.leaf.spring.y202002.day11.bio;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

public class Client {

	public static void main(String[] args) {

		try (Socket socket = new Socket("127.0.0.1", 5678);
				BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
				PrintWriter out = new PrintWriter(socket.getOutputStream(), true)) {

			out.println("接收到客户端请求数据");
			String response = in.readLine();

			System.out.println("客户端：" + response);

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
